/**
 * 修正各浏览器之间的差异问题
 * 
 * jQuery - based
 * LiveQuery - based
 * 
 * @author Bevis.Zhao
 */
(function($){
	var DBFixer = function(){
		
	};
	
	DBFixer.prototype = {
		/**
		 * 修正鼠标滑过, 为鼠标滑过添加事件 载入滑过样式
		 * 为任意标签添加如下标记
		 * - hover : 滑过时载入值样式
		 * - showdelay : 显示延时 required attribute<hover>
		 * - hidedelay : 隐藏延迟 required attribute<hover>
		 */
		fixHover : function(element, a_hidedelay, a_showdelay){
			$('*[hover]', element).livequery(function(){
				var $self = $(this);
				var hoverClassName = $self.attr('hover');
				var showDelayMethod, hideDelayMethod ;
				
				$self.mouseenter(function(){
					clearTimeout(hideDelayMethod);
					showDelayMethod = setTimeout(function(){
						$self.addClass(hoverClassName);	
					}, a_showdelay || $self.attr('showdelay') || 0);
				}).mouseout(function(){
					clearTimeout(showDelayMethod);
					hideDelayMethod = setTimeout(function(){
						$self.removeClass(hoverClassName);
					}, a_hidedelay || $self.attr('hidedelay') || 0);
				});
			});	
		}	
	};
	
	
	// IE下ul li等鼠标滑过时闪动
	if($.browser.msie)
			document.execCommand("BackgroundImageCache", false, true);
	
	// Publish
	window.DBFixer = new DBFixer();
})(jQuery);
